cf5b44
@@ -31,6 +31,7 @@
import org.apache.camel.ShutdownRunningTask;
 import org.apache.camel.impl.ScheduledBatchPollingConsumer;
 import org.apache.camel.support.EmptyAsyncCallback;
 import org.apache.camel.util.CastUtils;
+import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StopWatch;
 import org.apache.camel.util.StringHelper;
 import org.apache.camel.util.TimeUtils;
@@ -697,6 +698,9 @@
public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
             // create a dummy exchange as Exchange is needed for expression evaluation
             Exchange dummy = endpoint.createExchange();
             fileExpressionResult = endpoint.getFileName().evaluate(dummy, String.class);
+            if (dummy.getException() != null) {
+                throw ObjectHelper.wrapRuntimeCamelException(dummy.getException());
+            }
         }
         return fileExpressionResult;
     }
